// pages/main/dream-list-page/components/dream-list-item/dream-list-item.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    //是否正在加载更多
    loadingMore:{
      type:Boolean,
      value:false
    },
    //整个列表数据的大小
    listSize: {
      type: Number,
      value: 0
    },
    //该数据的下标
    index: {
      type: Number,
      value: 0
    },
    // 分享的日期
    date: {
      type: Object,
      value: {
        year: '2021',
        month: '1',
        day: '18',
        time: '00:18',
        weekday: '周 五'
      }
    },
    // 分享人的信息
    author: {
      type: Object,
      value: {
        nickname: 'blue',
        sex: 1,
        avatarUrl: 'https://thirdwx.qlogo.cn/mmopen/vi_32/B5YoA7b4Aee2BCqibkQ85kgyr4icM7pAs3yXSDyygsmzHeMXuQlgXYa0rzKibBpUl1MiazJsVJKOAuYic7X70YD9mMg/132'
      }
    },
    //梦的相关信息
    dreamInfo: {
      type: Object,
      value: {
        content: '梦到自己变成了🐖',
        like: 0,
        comment: 0,
        tag: '糟糕',
        releaseTag: '刚刚'
      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    likeColor: '#989797',
    icons: {
      moon: '',
      circle: '',
      like: '',
      liked: '',
      comment: '',
      more: ''
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    loadMoreDreams:function(){
      
    },
    //点赞或取消点赞
    beLiked: function() {
      let that = this;
      this.setData({
        likeColor: that.data.likeColor === '#FF4D4D' ? '#989797' : '#FF4D4D'
      })
    },
    //显示评论框
    toComment: function() {
      this.triggerEvent("commenting", true);
    }
  }
})